package com.project.rfidpage.controller;


import com.github.pagehelper.PageInfo;
import com.project.rfidpage.aop.TagLog;
import com.project.rfidpage.dto.SearchByRqParam;
import com.project.rfidpage.service.RidDailyService;
import com.project.rfidpage.util.RestResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api/rfidpage/rid/daily/")
public class RidDailyController extends BaseController {

    @Resource
    RidDailyService ridDailyService;

    /**
     * 基站运行日报列表查询
     */
    @PostMapping("page")
    @TagLog(operation = 0, content = "查询基站运行日报列表")
    public RestResult dailyPage(@RequestBody SearchByRqParam param) {
        this.getPage(true, param);
        return RestResult.ok(new PageInfo<>(ridDailyService.getListForPage(param)));
    }

    /**
     * 基站运行日报导出列表
     */
    @PostMapping("output")
    @TagLog(operation = 5, content = "导出基站运行日报列表")
    public RestResult dailyOutput(@RequestBody SearchByRqParam param) {
        this.getPage(false, param);
        return RestResult.ok(ridDailyService.getListForPage(param));
    }

    /**
     * 基站营运质量日报列表查询
     */
    @PostMapping("run/page")
    @TagLog(operation = 0, content = "查询基站营运质量日报列表")
    public RestResult dailyRunPage(@RequestBody SearchByRqParam param) {
        this.getPage(true, param);
        return RestResult.ok(new PageInfo<>(ridDailyService.getDailyListForPage(param)));
    }

    /**
     * 基站营运质量日报导出列表
     */
    @PostMapping("run/output")
    @TagLog(operation = 5, content = "导出基站营运质量日报列表")
    public RestResult dailyRunOutput(@RequestBody SearchByRqParam param) {
        this.getPage(false, param);
        return RestResult.ok(ridDailyService.getDailyListForPage(param));
    }
}
